home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -websites- / wirenet / files / thor25_arexx.lha / GoldED / CancelEvent.ged < prev    next >
Text File  |  1996-10-26  |  2KB  |  86 lines

  1. /* CancelEvent.ged by Troels Walsted Hansen
  2. ** $VER: CancelEvent.ged v1.00 (09.06.95)
  3. **
  4. ** Run this script when aborting an event in GoldED. The script will
  5. ** quit GoldED without saving and delete the event in THOR.
  6. */
  7.  
  8. options results
  9.  
  10. /* needs GoldED, THOR and bbsread.library functions */
  11.  
  12. if(substr(address(),1,6) ~= "GOLDED") then
  13. do
  14.     say "This script should only be started from inside GoldED."
  15.     exit 20
  16. end
  17. else gedport = address()
  18.  
  19. p = ' ' || address() || ' ' || show('P',,)
  20. thorport = pos(' THOR.',p)
  21.  
  22. if thorport > 0 then thorport = word(substr(p,thorport+1),1)
  23. else
  24. do
  25.     say 'No THOR port found!'
  26.     exit 10
  27. end
  28.  
  29. if ~show('p', 'BBSREAD') then
  30. do
  31.     address command
  32.         "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
  33.         "WaitForPort BBSREAD"
  34. end
  35.  
  36. /* quit without saving */
  37.  
  38. address(gedport)
  39. QUERY FILE VAR filename
  40. QUIT NOSAVE
  41.  
  42. address(thorport)
  43. CURRENTBBS stem CURRENT
  44. if(rc ~= 0 | CURRENT.BBSNAME ~= "") then bbs = CURRENT.BBSNAME
  45. else exit
  46.  
  47. /* traverse eventlist to find the correct message event */
  48.  
  49. address(bbsread)
  50. GETBBSDATA '"'bbs'"' stem BBSDATA
  51. if(rc ~= 0) then
  52. do
  53.     address(thorport)
  54.     REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
  55.     exit 5
  56. end
  57.  
  58. do i=BBSDATA.FIRSTEVENT to BBSDATA.LASTEVENT
  59.     drop MSGTAGS.
  60.  
  61.     READBREVENT BBSNAME '"'bbs'"' EVENTNR i TAGSSTEM MSGTAGS
  62.     if(rc ~= 0) then
  63.     do
  64.         address(thorport)
  65.         REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
  66.         exit 5
  67.     end
  68.  
  69.     if(filename = MSGTAGS.MSGFILE) then
  70.     do
  71.         /* mark the event as deleted */
  72.  
  73.         UPDATEBREVENT BBSNAME '"'bbs'"' EVENTNR i SETDELETED
  74.         if(rc ~= 0) then
  75.         do
  76.             address(thorport)
  77.             REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
  78.             exit 5
  79.         end
  80.  
  81.         exit
  82.     end
  83. end
  84.  
  85. exit
  86.